package os.kernelProcess.queues;

import os.MiniSemaphore;
import os.MiniThread;

/**
 * Super class of all <b>"Ready"</b> queues in all scheduling schemes. Examples
 * of possible subclasses: FCFS (First-Come First-Serve), LCFS (Last-Come
 * First-Serve).
 * 
 * @author Ahmed El-Eryan
 */
public abstract class MiniQueue
{

	/**
	 * Keeps the current contents of the queue. <b>You can change the type of
	 * the queue. This is just for illustration.</b>
	 */
//	protected ArrayList<MiniThread> queue = new ArrayList<MiniThread>();
//	protected LinkedList<MiniThread> queue = new LinkedList<MiniThread>();

	protected MiniSemaphore accessQueue = new MiniSemaphore(1);
	
	/**
	 * Gets the head of the queue (i.e next thread to run). The returned thread
	 * is determined by the type of the queuing scheme implemented.
	 * 
	 * @return Head of the queue.
	 */
	public abstract MiniThread getHead();

	/**
	 * Appends a thread to the queue. The place to add this thread is determined
	 * by the queuing scheme implemented.
	 * 
	 * @param thread
	 *            Thread to be added.
	 */
	public abstract void append(MiniThread thread);
	public abstract int getSize();
	public abstract MiniThread removeThread(String tid);
}
